package com.tianjishuju.cimiss.station.station.util;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;


/**
 * @author Blithe.Lee
 *
 */
class ObjectMapperUtil {

	private final static String locker = "locker";
	private static ObjectMapper OBJECT_MAPPER_FOR_ROUTING;

	public static ObjectMapper getObjectMapperForRouting() {
		
		if (OBJECT_MAPPER_FOR_ROUTING == null){
			synchronized (locker) {
				if (OBJECT_MAPPER_FOR_ROUTING == null){
					OBJECT_MAPPER_FOR_ROUTING = new ObjectMapper();
				}
			}
			OBJECT_MAPPER_FOR_ROUTING.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
			OBJECT_MAPPER_FOR_ROUTING.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true);
			OBJECT_MAPPER_FOR_ROUTING.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true);
		}
		return OBJECT_MAPPER_FOR_ROUTING;
	}
	
}
